const { Sequelize } = require('sequelize');

const db = new Sequelize('sequelize', 'root', 'Hjw123456..', {
    host: '127.0.0.1',
    dialect: 'mysql'
});



// 测试连接是否成功
(async () => {
    try {
        await db.authenticate();
        console.log('数据库连接成功.');
    } catch (error) {
        console.error('Unable to connect to the database:', error);
    }
})();   // 多一个括号表示调用方法


module.exports = db;